<template>
  <div class="login">
    <el-form ref="lnterviewForm" :model="lnterviewForm">
      <el-tabs type="border-card" style="width: 150%">
        <el-tab-pane label="我要问问题">
            <el-form-item label="" prop="realName">
              <el-input v-model="lnterviewForm.realName" placeholder="请输入真实姓名" />
            </el-form-item>
            <el-form-item label="" prop="email">
              <el-input v-model="lnterviewForm.email" placeholder="请输入邮箱" />
            </el-form-item>
            <el-form-item label="" prop="weChat">
              <el-input v-model="lnterviewForm.weChat" placeholder="请输入微信" />
            </el-form-item>
            <el-form-item label="" prop="phone">
              <el-input v-model="lnterviewForm.phone" placeholder="请输入电话" />
            </el-form-item>
            <el-form-item label="" prop="classId">
              <el-select v-model="lnterviewForm.classId" placeholder="请选择班级">
                <el-option
                  v-for="item in options"
                  :key="item.id"
                  :label="item.name"
                  :value="item.name">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="" prop="appointmentTime">
              <el-date-picker clearable
                              v-model="lnterviewForm.appointmentTime"
                              type="date"
                              value-format="yyyy-MM-dd"
                              placeholder="请选择预约时间">
              </el-date-picker>
            </el-form-item>
          <el-form-item label="" prop="questionTypeId">
            <el-select v-model="lnterviewForm.questionTypeId" placeholder="请选择问题类型">
              <el-option
                v-for="item in question_typeList"
                :key="item.id"
                :label="item.questionType"
                :value="item.questionType">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="" prop="teacherId">
            <el-select v-model="lnterviewForm.teacherId" placeholder="请选择老师">
              <el-option
                v-for="item in options"
                :key="item.id"
                :label="item.name"
                :value="item.name">
              </el-option>
            </el-select>
          </el-form-item>
            <el-form-item label="" prop="problemDescription">
              <el-input type="textarea" v-model="lnterviewForm.problemDescription" placeholder="请输入问题描述" />
            </el-form-item>
          <el-button type="primary" @click="reservation" style="width: 100%">提交预约</el-button>
        </el-tab-pane>

        <el-tab-pane label="面试登记">
          <el-form-item label="" prop="classId">
            <el-select v-model="lnterviewForm.classId" placeholder="请选择班级">
              <el-option
                v-for="item in options"
                :key="item.id"
                :label="item.name"
                :value="item.name">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="" prop="realName">
            <el-input v-model="lnterviewForm.realName" placeholder="请输入真实姓名" />
          </el-form-item>
          <el-form-item label="" prop="startTime">
            <el-date-picker clearable
                            v-model="lnterviewForm.startTime"
                            type="date"
                            value-format="yyyy-MM-dd"
                            placeholder="请选择开始时间">
            </el-date-picker>
          </el-form-item>
          <el-form-item label="" prop="companyName">
            <el-input v-model="lnterviewForm.companyName" placeholder="请输入公司名字" />
          </el-form-item>
          <el-form-item label="" prop="personnelName">
            <el-input v-model="lnterviewForm.personnelName" placeholder="请输入人事名字" />
          </el-form-item>
          <el-form-item label="" prop="personnelPhone">
            <el-input v-model="lnterviewForm.personnelPhone" placeholder="请输入人事电话" />
          </el-form-item>
          <el-form-item label="" prop="interviewAddress">
            <el-input v-model="lnterviewForm.interviewAddress" placeholder="请输入面试地址" />
          </el-form-item>
          <el-form-item label="" prop="notes">
            <el-input type="textarea" v-model="lnterviewForm.notes" placeholder="请输入备注" />
          </el-form-item>
          <el-button type="primary" @click="submitForm" style="width: 100%">提交登记</el-button>
        </el-tab-pane>
      </el-tabs>

    </el-form>
  </div>
</template>

<script>
import { getClass,pull,listQuestion_type,reservation_submit } from "@/api/helpInterview";
import Cookies from "js-cookie";
import { encrypt, decrypt } from '@/utils/jsencrypt'

export default {
  name: "HelpInterview",
  data() {
    return {
      //查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        questionType: null
      },
      //问题分类表格数据
      question_typeList:[],
      options:[],
      reservationForm:{

      },
      lnterviewForm: {
        classId: 0,
        realName: null,
        startTime: null,
        companyName: null,
        personnelName: null,
        personnelPhone: null,
        interviewAddress: null,
        notes: null,
        email: null,
        weChat: null,
        phone: null,
        appointmentTime: null,
        questionTypeId: 0,
        teacherId: 0,
        problemDescription: null
      },
    };
  },
  methods: {
    getStudentClass(){
      // getClass.then(res=>{
      //   console.log(res)
      //   this.options = res.data();
      // })
    },
    submitForm(){
      pull(this.lnterviewForm).then(res=>{

      })
    },
    getQuaryList(){
      this.loading = true;
      listQuestion_type(this.queryParams).then(res=>{
        console.log(res)
        this.question_typeList = res.rows;
        this.total = res.total;
        this.loading = false;
      })
    },
    reservation(){
      // this.$refs["lnterviewForm"].validate(valid => {
      //   if (valid) {
      //     if (this.form.id != null) {
            pull(this.lnterviewForm).then(res => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            })
      //     }
      //   }
      // });
    }

  },
  mounted() {
    this.getStudentClass();
    this.getQuaryList();
  }
};
</script>

<style rel="stylesheet/scss" lang="scss">
.login {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  background-image: url("../assets/images/login-background.jpg");
  background-size: cover;
}
.title {
  margin: 0px auto 30px auto;
  text-align: center;
  color: #707070;
}

.login-form {
  border-radius: 6px;
  background: #ffffff;
  width: 400px;
  padding: 25px 25px 5px 25px;
  .el-input {
    height: 38px;
    input {
      height: 38px;
    }
  }
  .input-icon {
    height: 39px;
    width: 14px;
    margin-left: 2px;
  }
}
.login-tip {
  font-size: 13px;
  text-align: center;
  color: #bfbfbf;
}
.login-code {
  width: 33%;
  height: 38px;
  float: right;
  img {
    cursor: pointer;
    vertical-align: middle;
  }
}
.el-login-footer {
  height: 40px;
  line-height: 40px;
  position: fixed;
  bottom: 0;
  width: 100%;
  text-align: center;
  color: #fff;
  font-family: Arial;
  font-size: 12px;
  letter-spacing: 1px;
}
.login-code-img {
  height: 38px;
}
</style>
